/**
 * Copyright (c) 2011 eelpo.com
 * All rights reserved.
 */
package com.eelpo.cmmp.core.wicket.page.extensions;

import com.eelpo.cmmp.core.wicket.component.label.ErrorLevelsFeedbackMessageFilter;
import com.eelpo.cmmp.core.wicket.page.basic.DeniedPage;

import org.apache.wicket.feedback.FeedbackMessage;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.panel.FeedbackPanel;

/**
 * <pre>
 * 
 * 基础页面，作为新增修改的基类页面
 * 
 * </pre>
 * 
 * @author <a href="mailto:Brian@eelpo.com">汪洪州</a>
 * @since 1.0
 */
public class SimpleWebPage extends DeniedPage {

	public SimpleWebPage(String title) {
		add(renderTitleLabel("title", title));
	}

	protected Label renderTitleLabel(String id, String title) {
		return new Label(id, title);
	}

	public FeedbackPanel renderFeedbackPanel(String id, int filteredErrorLevels) {
		FeedbackPanel feedbackPanel = new FeedbackPanel(id);
		feedbackPanel.setFilter(new ErrorLevelsFeedbackMessageFilter(filteredErrorLevels));
		return feedbackPanel;
	}

	public FeedbackPanel renderFeedbackPanel(String id) {
		FeedbackPanel feedbackPanel = new FeedbackPanel(id);
		feedbackPanel.setFilter(new ErrorLevelsFeedbackMessageFilter(FeedbackMessage.ERROR));
		return feedbackPanel;
	}
}
